package com.powernode.controller;




import com.powernode.pojo.*;
import com.powernode.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author 姚崇崇
 * TODO
 */
@Controller
public class IndexController {
    @Autowired
    DormitoryAdminService dormitoryAdminService;

    @Autowired
    IsolatedManService isolatedManService;

    @Autowired
    FloorAdminService floorAdminService;

    @Autowired
    DailyReportService dailyReportService;

    @Autowired
    TowerAdminService towerAdminService;

    @GetMapping("/dormitoryAdminEdit/{id}")
    public String bookEdit(@PathVariable Integer id, Model model){
        DormitoryAdmin dormitoryAdmin = dormitoryAdminService.get(id);
        model.addAttribute("dormitoryAdmin",dormitoryAdmin);
        return "DormitoryAdminEdit";
    }
    @GetMapping("/isolatedManEdit/{id}")
    public String cardEdit(@PathVariable Integer id, Model model){
        IsolatedMan isolatedMan = isolatedManService.get(id);
        model.addAttribute("isolatedMan",isolatedMan);
        return "IsolatedManEdit";
    }
    @GetMapping("/floorAdminEdit/{id}")
    public String patientEdit(@PathVariable Integer id, Model model){
        FloorAdmin floorAdmin = floorAdminService.get(id);
        model.addAttribute("floorAdmin",floorAdmin);
        return "FloorAdminEdit";
    }
    @GetMapping("/dailyReportEdit/{id}")
    public String card001Edit(@PathVariable Integer id, Model model){
        System.out.println(id);
        DailyReport dailyReport = dailyReportService.getById(id);
        model.addAttribute("dailyReport",dailyReport);
        return "DailyReportEdit";
    }
    @GetMapping("/towerAdminEdit/{id}")
    public String messageEdit(@PathVariable Integer id, Model model){
        TowerAdmin towerAdmin = towerAdminService.get(id);
        model.addAttribute("towerAdmin",towerAdmin);
        return "TowerAdminEdit";
    }

}
